package com.dmgis.hndz.common.utils;

import com.mascloud.model.MoModel;
import com.mascloud.model.StatusReportModel;
import com.mascloud.sdkclient.Client;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;

import java.util.List;

public class SendSMSUtils {

    @Autowired
    private MongoTemplate template;
    private static final String snowflakeStr = "1839583293645918208";

    public static int sendSMS(String phone, String msg) {
        String[] phones = phone.split(",");
        Client client = Client.getInstance();
        boolean login = client.login("http://112.35.4.197:15000", "smsTest1", "GDHZxwx@#123", "山东省国土空间生态修复中心");
        if (login) {
            int i = client.sendDSMS(phones, msg, "", 5, "jzrqX54tG", snowflakeStr, true);
            switch (i) {
                case 1:
                    System.out.println("发送成功");
                    break;
                case 2:
                    System.out.println("发送失败，原因：短信内容不符合要求");
                    break;
                default:
                    System.out.println("发送失败");
            }
            List<StatusReportModel> report = client.getReport();
            List<MoModel> mo = client.getMO();
            return i;
        }
        return 0;
    }


}
